const express = require('express');
const config  = require('./config')
const bodyParser = require('body-parser')
const areaRouter = require('../router/area')
const userRouter = require('../router/user');
const articleRouter = require('../router/article')




const app = new express();
app.use(bodyParser.json())
.use(config.content_path,[areaRouter,userRouter,articleRouter])
.use('/public',express.static(config.public_assets_path))  // 公共静态资源目录

app.start = async function(){
    app.listen(config.port,()=>{
        console.log(`Server run at: http://localhost:${config.port}${config.content_path}`);
    });
}
module.exports = app;
